home *** CD-ROM | disk | FTP | other *** search
- @echo off
- cls
- echo %@upper[%0]:
- text
-
- This file contains several sample batch files. We invite you to
- study them in conjunction with your NDOS documentation. You may
- want to PRINT or LIST the contents and modify any part you wish. The
- various segments are separated from each other by a line of hyphens
- ("-") so you can easily extract the specific component you're most
- interested in.
-
- Included are:
-
- STATUS.BTM - Gives a quick description of your system.
- NMENU.BTM - A very simple menuing system.
- ONCEADAY.BTM - Runs a command during the first boot of the day.
-
- endtext
- pause
-
- : ---------------------------------------------------------------------
- rem STATUS.BTM
- rem
- rem This sample batch file will use some internal NDOS variable
- rem functions to try to describe your current configuration.
- rem
- cls
- echo.^echo.
- echo System status:
- echo.
- echo Date: %_dow %_date
- echo Time: %_time
- echo NDOS version: %_nver
- echo OS: %_dos
- echo DOS version: %_dosver
- echos `CPU: `
- iff %_cpu == 86 then
- echo 8088/8086
- elseiff %_cpu == 186 then
- echo 80188/80186
- elseiff %_cpu == 200 then
- echo V20/V30
- elseiff %_cpu == 286 then
- echo 80286
- elseiff %_cpu == 386 then
- echo 80386
- elseiff %_cpu == 486 then
- echo 80486
- endiff
- if %_ndp ne 0 echo %_ndp Numeric Coprocessor detected
- echo Video: %_video
- echo Monitor type: %_monitor
- quit
-
-
- : ---------------------------------------------------------------------
- : NMENU.BTM
- : This sample batch file will create a simple "menu" to run
- : your commonly used programs.
- :
- : Note that, instead of REM statements, it uses the alternative
- : practice of creating "do-nothing" labels by starting comment
- : lines such as this one with a ":"
- :
- @echo off
- : First, we define a couple of aliases which will be used several
- : times in the remainder of this batch file, after first saving
- : any existing alias by the same name with the SETLOCAL command.
- setlocal
- alias in `pushd %1 ^ %2& ^ popd`
- alias choice `elseiff "%userchoice" == "%1" then`
- :
- : Start with a clear screen
- cls
- :dispmenu
- : Position the cursor
- screen 8 0
- : Display the menu choices
- text
-
- Enter your choice:
-
- 0. EXIT
- 1. Word Processing
- 2. Spreadsheet
- 3. Communications
-
- endtext
- : Ask the user to enter a value for environment variable CHOICE
- inkey Which? %%userchoice
- : Does the user want to exit the menu?
- iff "%userchoice" == "0" then ^ quit
- : Check the valid options
- : Each line corresponds to a menu choice
- : The parameters are a directory to go to, then the program to run
- choice 1 ^ in c:\letters c:\ws\ws.exe
- choice 2 ^ in d:\finance c:\quattro\q.exe
- choice 3 ^ in c:\awremote c:\awremote\awremote.exe
- else
- : The user entered an invalid option
- scrput 23 0 bri whi on red Invalid choice, try again
- endiff
- : Loop back to the beginning
- goto dispmenu
-
-
- : ---------------------------------------------------------------------
- : ONCEADAY.BTM
- @echo off
- :
- : This batch file will start a specified command the first time it
- : is called each day after 6:00 in the morning
- : example:
- : ONCEADAY NDD C: /Q
- :
- : Note that, instead of REM statements, it uses the alternative
- : practice of creating "do-nothing" labels by starting comment
- : lines such as this one with a ":"
- :
- :
- : First, we reset environment variable LASTDATE after saving any
- : current value it may already have with the SETLOCAL command
- setlocal
- set lastdate=0
- : Is there already a file called ONCEADAY.DAT in the
- : root directory of the boot drive?
- iff exist %_boot:\onceaday.dat then
- : If so, set LASTDATE to the contents of the first line
- set lastdate=%@line[%_boot:\onceaday.dat,0]
- endiff
- : Is the date in the file greater than today's date?
- : (the @DATE function turns a date into an integer number)
- iff %@date[%_date] gt %lastdate then
- : If so, is it currently past 6:00? (an arbitrary time)
- iff %@time[%_time] gt %@time[06:00] then
- : Yes! Invoke whatever command was passed as an argument to this
- : batch file, then return
- call %&
- : After executing the command, place today's date in integer
- : format into file ONCEADAY.DAT
- echo %@date[%_today] >! %_boot:\onceaday.dat
- endiff
- endiff
- :
-